<?php
    $cs=Yii::app()->clientScript;
    $cs->registerScriptFile(Yii::app()->request->baseUrl."/js/ckeditor/ckeditor.js");
    $cs->registerScript('form','
            //Start ckeditor setup
            if ( typeof CKEDITOR == "undefined" ){
	            document.write("CKEditor not found." ) ;
            } else {
	            //ckeditor
                var editor = CKEDITOR.replace( "body", {
                height: "300",
                width:650,
                resize_maxWidth : 650,
                });
            } //End ckeditor setup
        ',
        CClientScript::POS_END
    );
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'email-template-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note"><?php echo strtr(Yii::t('BackEnd', 'The fields {*} are required.'), array('{*}'=>'<span class="required">*</span>'))?></p>
	
    <table id="EmailTemplate-basic-info" class="form-view">
        <tr class="odd">
            <th><?php echo $form->labelEx($model,'code'); ?></th>
            <td>
            <?php echo $form->textField($model,'code',array('size'=>45,'maxlength'=>45, 'readonly'=>'readonly')); ?>
            <?php echo $form->error($model,'code'); ?>
            </td>
        </tr>
        <tr class="even">
            <th><?php echo $form->labelEx($model,'title'); ?></th>
            <td>
            <?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>255)); ?>
            <?php echo $form->error($model,'title'); ?>
            </td>
        </tr>
        <tr class="odd">
            <th><?php echo $form->labelEx($model,'subject'); ?></th>
            <td>
            <?php echo $form->textField($model,'subject',array('size'=>60,'maxlength'=>255)); ?>
            <?php echo $form->error($model,'subject'); ?>
            </td>
        </tr>
        <tr class="even">
            <th><?php echo $form->labelEx($model,'body'); ?></th>
            <td>
                <?php echo $form->textArea($model, 'body', array('style'=>'height:200px;', 'id' => 'body'));?>

                <?php echo $form->error($model,'body'); ?>
            </td>
        </tr>
        <tr class="odd">
            <th><?php echo $form->labelEx($model,'from'); ?></th>
            <td>
            <?php echo $form->textField($model,'from',array('size'=>60,'maxlength'=>255)); ?>
            <?php echo $form->error($model,'from'); ?>
            </td>
        </tr>
        <!--<tr class="even">
            <th><?php //echo $form->labelEx($model,'params'); ?></th>
            <td>
            <?php //echo $form->textArea($model,'params', array('style'=>"width:400px;height:100px")); ?>
                <div><?php echo Yii::t('BackEnd', 'Param format like Json format');?>.</div>
                <div>
                    <?php //echo Yii::t('BackEnd', 'Example');?>: 
                    {"name1":"value", name2:[value1, value2, value3]}
                </div>
            <?php //echo $form->error($model,'params'); ?>
            </td>
        </tr>  -->
        <tr class="even">
            <th><?php echo $form->labelEx($model,'status'); ?></th>
            <td>
            <?php echo $form->dropDownList($model,'status', Lvc::statusArray(Yii::t('BackEnd', '-- All --'))); ?>
            <?php echo $form->error($model,'status'); ?>
            </td>
        </tr>
    </table>
    <input type="submit" style="display:none"/>
<?php $this->endWidget(); ?>

</div><!-- form -->